#include <vsync/thread/mutex/musl.h>
#include <tilt.h>

typedef struct tilt_mutex {
    vmutex_t lock;
} tilt_mutex_t;

static void
tilt_mutex_init(tilt_mutex_t *m)
{
    vmutex_init(&m->lock);
}

static void
tilt_mutex_destroy(tilt_mutex_t *m)
{
}

static bool
tilt_mutex_trylock(tilt_mutex_t *m)
{
    return vatomic32_cmpxchg_acq(&m->lock, 0U, 1U) == 0U;
}

static void
tilt_mutex_lock(tilt_mutex_t *m)
{
    
    vmutex_acquire(&m->lock);

}

static void
tilt_mutex_unlock(tilt_mutex_t *m)
{
    vmutex_release(&m->lock);
}
